News All Tests
Current file: /home/estudydev/workspace/MSP09/web/news/tests/class.categories.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
37.50 %37.50%
37.50% 3 / 8
66.67 %66.67%
66.67% 10 / 15
 
Categories
100.00 %100.00%
100.00% 1 / 1
37.50 %37.50%
37.50% 3 / 8
66.67 %66.67%
66.67% 10 / 15
 public function __construct(array $categories)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 2 / 2
 public function hasCategory($id)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 4 / 4
 public function getCategory($id)
100.00 %100.00%
100.00% 1 / 1
100.00 %100.00%
100.00% 4 / 4
 public function current()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function key()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function next()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function rewind()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function valid()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1


       1                 : <?php                                                                        
       2                 : /*--------------------------------------------------------------------------+
       3                 : This file is part of eStudy.                                                 
       4                 : - Modulgruppe:  News                                                         
       5                 : - Beschreibung: Verwaltet Category-Objekte                                   
       6                 : - Version:      1.0, 28/03/09                                                
       7                 : - Autor(en):    Christoph Thelen <christoph.thelen@mni.fh-giessen.de>        
       8                 : +---------------------------------------------------------------------------+
       9                 : This program is free software; you can redistribute it and/or                
      10                 : modify it under the terms of the GNU General Public License                  
      11                 : as published by the Free Software Foundation; either version 2               
      12                 : of the License, or any later version.                                        
      13                 : +---------------------------------------------------------------------------+
      14                 : This program is distributed in the hope that it will be useful,              
      15                 : but WITHOUT ANY WARRANTY; without even the implied warranty of               
      16                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                
      17                 : GNU General Public License for more details.                                 
      18                 : You should have received a copy of the GNU General Public License            
      19                 : along with this program; if not, write to the Free Software                  
      20                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  
      21                 : +--------------------------------------------------------------------------*/
      22                 :                                                                              
      23                 : class Categories implements Iterator {                                       
      24                 :                                                                              
      25                 :     /**                                                                      
      26                 :      * @var array                                                            
      27                 :      */                                                                      
      28                 :     private $categories;                                                     
      29                 :                                                                              
      30                 :     public function __construct(array $categories) {                         
      31               5 :         $this->categories = $categories;                                     
      32               5 :     }                                                                        
      33                 :                                                                              
      34                 :     public function hasCategory($id) {                                       
      35               4 :         foreach ($this->categories as $category) {                           
      36               3 :             if ($category->getId() == $id) return true;                      
      37               3 :         }                                                                    
      38               2 :         return false;                                                        
      39                 :     }                                                                        
      40                 :                                                                              
      41                 :     public function getCategory($id) {                                       
      42               1 :         foreach ($this->categories as $category) {                           
      43               1 :             if ($category->getId() == $id) return $category;                 
      44               1 :         }                                                                    
      45               1 :         return null;                                                         
      46                 :     }                                                                        
      47                 :                                                                              
      48                 :     public function current() {                                              
      49               0 :         return current($this->categories);                                   
      50                 :     }                                                                        
      51                 :                                                                              
      52                 :     public function key() {                                                  
      53               0 :         return key($this->categories);                                       
      54                 :     }                                                                        
      55                 :                                                                              
      56                 :     public function next() {                                                 
      57               0 :         return next($this->categories);                                      
      58                 :     }                                                                        
      59                 :                                                                              
      60                 :     public function rewind() {                                               
      61               0 :         return reset($this->categories);                                     
      62                 :     }                                                                        
      63                 :                                                                              
      64                 :     public function valid() {                                                
      65               0 :         return $this->current() !== false;                                   
      66                 :     }                                                                        
      67                 : }                                                                            

Generated by PHPUnit 3.2.21 and Xdebug 2.0.4 at Sat Nov 7 22:04:08 CET 2009.